package com.example.front.dao;

import com.example.gok_mall.entity.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface OrderDao {
    int deleteByPrimaryKey(Integer id);

    int insert(Order record);

    int insertSelective(Order record);

    Order selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Order record);

    int updateByPrimaryKey(Order record);

    //根据订单号和用户的Id来查询订单
    Order selectByUserIdAndOrderNo(@Param("userId") Integer userId,@Param("orderNo") Long orderNo);

    //根据订单号来查询订单是否存在
    Order selectByOrderNo(Long orderNo);

    //根据用户Id来查询订单列表
    List<Order> getOrderListByUserId(Integer userId);

    //管理员查看订单列表实现
    List<Order> selectAllOrder();
}